home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-12-11 | 5.2 KB | 204 lines | [TEXT/MPS ] |
- /*
- File: Selection.h
-
- Contains: Palette Classes Definition
-
- Written by: Dave Stafford
-
- Copyright: © 1995 by Apple Computer, Inc., all rights reserved.
- */
-
- // -- DrawEditor Includes --
-
- #ifndef _SELECTION_
- #define _SELECTION_
-
- #ifndef _DRAWCONTENT_
- #include "DrawContent.h"
- #endif
-
- //=============================================================================
- // CSelection
- //=============================================================================
- class CSelection
- {
- public:
-
- // -- Init --
- CSelection(DrawEditor* editor, ODBoolean allowPublish, ODBoolean allowSubscribe);
- virtual ~CSelection();
-
- public:
-
- // -- Accessors --
- ODShape* GetUpdateShape();
-
- // -- Collection --
- virtual ODBoolean ContainsFrozen() const;
- virtual ODBoolean IsCompletelyUnfrozen() const; // HasNotFrozen
- void SetFrozen(Environment* ev, ODBoolean state);
-
- virtual ODBoolean IsEmpty() const;
-
- void Add(Environment* ev, CShape* shape);
- void Remove(Environment* ev, CShape* shape);
-
- // -- Drawing --
- void InvalidateSelection(Environment* ev, ODFrame* frame);
- void DrawSelectionHandles(Environment* ev, ODFacet* facet, ODBoolean turnOn);
- void DrawShapeHandles(Environment* ev, CShape* shape, ODBoolean turnOn);
- void DrawHandlesForAllFacets(Environment* ev, ODFrame* frame, ODBoolean turnOn);
-
- // -- Activation --
- void Activate(Environment* ev, ODBoolean activating, ODFrame* frame);
-
- // -- Selection --
- ODBoolean ClearSelection(Environment* ev, ODFrame* frame);
- void CloseSelection(Environment* ev);
- void SelectAll(Environment* ev, ODFrame* frame);
-
- void AddToSelection(Environment* ev, CShape* theShape, ODBoolean drawHandles);
- void RemoveFromSelection(Environment* ev, CShape* theShape, ODBoolean drawHandles);
-
- ODBoolean TrackRectangle(Environment* ev, ODEventData* event, Rect* selection);
- void SelectWithRectangle(Environment* ev, ODFacet* facet, ODEventData* event);
- void SelectWithShape(Environment* ev,
- ODFacet* facet,
- ODEventData* event,
- CShape* shape);
-
- void ChangeSelectionColor(Environment* ev, const CRGBColor& color);
-
- // -- Dragging --
- void Dragging(Environment* ev, ODBoolean dragging );
- void GetSelectionRectangle(ODRect* rectangle);
- ODShape* CreateDragShape(Environment* ev, ODFacet* facet, ODFrame* frame);
-
- void CalcUpdateShape(Environment* ev); // Was CalcCache
- void OffsetSelection(Environment* ev,
- ODFrame* containingFrame,
- ODCoordinate hOffset,
- ODCoordinate vOffset);
-
- // -- Events --
- CShape* WhichHandle(Environment* ev,
- ODFacet* facet,
- const Point& mouse,
- short* whichHandle) const;
-
- // -- Resize --
- void TrackResize(Environment* ev,
- ODFacet* facet,
- ODEventData* event,
- ODSShort whichHandle,
- CShape* shape,
- Point* result);
-
- void ResizeSelection(Environment* ev,
- ODFrame* containingFrame,
- Rect baseRect,
- Rect resizeRect);
-
-
- void Resize(Environment* ev,
- CShape* anchor,
- ODFacet* containingFacet,
- short whichHandle,
- ODEventData* event);
-
-
- // ----- Change Notify -----
- void SelectedContentUpdated(Environment* ev, ODBoolean doClear = kODFalse);
- ODBoolean IsPromisedToClipboard();
-
- // -- Storage --
-
- void ExternalizeSingleEmbeddedFrame(Environment* ev,
- ODStorageUnit* storage,
- CCloneInfo* info,
- ODFrame* embeddedFrame);
-
- void HandleInternalizeContent(Environment* ev,
- ODStorageUnit* storageUnit,
- CCloneInfo* info);
-
- void HandleTranslateContent(Environment* ev,
- ODStorageUnit* storageUnit,
- CCloneInfo* info,
- ODBoolean embedOrMerge);
-
- void SetInLimbo(Environment* ev, ODBoolean isInLimbo );
-
- // Linking
-
- CPublishLink *FindPublisher();
-
- virtual void AddShapeToPart(Environment* ev, CShape* shape);
- void AddPublishLink(CPublishLink* link);
-
- void RemovePublishLink(CPublishLink* link);
-
- void AddSubscribeLink(CSubscribeLink* link);
-
- void RemoveSubscribeLink(CSubscribeLink* link);
- void IncrementPartialSubscribeCount(ODUShort increment);
-
- ODBoolean CanMoveSelectedContent(CSubscribeLink*& link);
-
- ODBoolean CanEditSelectedContent();
- ODBoolean CanPublish();
- CEmbeddingShape* IsOneEmbeddedShape(Environment* ev);
- COrderedList* GetShapeList();
-
- CDrawContent* GetSelectionContent();
-
- COrderedList* GetPublishLinks();
-
- COrderedList* GetSubscribeLinks();
-
- ODULong Count();
-
- DrawEditor* GetDrawEditor();
- ODBoolean CanMoveSelectedContent();
-
- ODBoolean CanEditSelectedContent(CSubscribeLink*& link);
-
- ODBoolean IsOneLink();
-
-
-
-
-
-
-
- //----------------------------------------------------------------------------------------
- // Data Members
- //
- private:
- DrawEditor* fDrawEditor;
- ODUShort fEmbeddingShapeCount;
- ODUShort fFrozenCount;
-
- Rect fSelectionRectangle;
- ODShape* fUpdateShape;
-
- ODBoolean fAllowPublish;
- ODBoolean fAllowSubscribe;
-
- ODUShort fPartialSubscribeCount;
-
- CSelectionContent* fSelectionContent;
-
- // convenience references
- COrderedList* fShapeList;
- COrderedList* fPublishLinks;
- COrderedList* fSubscribeLinks;
-
-
- };
-
-
-
-
-
- #endif